package com.zhangxin.designmode.oop.demo1;

/**
 *
 * @author zhangxin
 * @date 2022/4/2
 */
public class DynamicArray {
    private static final int DEFAULT_CAPACITY = 10;
    protected int size = 0;
    protected int capacity = DEFAULT_CAPACITY;
    protected Integer[] elements = new Integer[DEFAULT_CAPACITY];

    public int size(){
        return this.size;
    }
    public Integer get(int index){
        return elements[index];
    }

    public void add(Integer e){
        ensureCapacity();
        elements[size++] = e;
    }

    void ensureCapacity() {

    }
}
